//
//  WWActiveCell.m
//  Shopping
//
//  Created by 孙博 on 16/8/20.
//  Copyright © 2016年 张湾湾. All rights reserved.
//

#import "WWActiveCell.h"
#import <UIImageView+WebCache.h>

@interface WWActiveCell ()

@property (nonatomic, weak)UIImageView *imgView;

@end

@implementation WWActiveCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
//        [self setupUI];
    }
    return  self;
}

- (void)setImgURL:(NSString *)imgURL{
    _imgURL = imgURL;
    
    [self setupUI];
}

- (void)setupUI{
    UIImageView *imgView = [[UIImageView alloc]initWithFrame:CGRectZero];
    self.imgView = imgView;
//    self.backgroundColor = [UIColor clearColor];
//    self.layoutMargins = UIEdgeInsetsMake(0, 10, 0, 10);
    
    [self.contentView addSubview:imgView];
    
    NSURL *url = [NSURL URLWithString:self.imgURL];

    [imgView sd_setImageWithURL:url];
}

- (void)layoutSubviews{
    [super layoutSubviews];
    
    self.imgView.frame = self.contentView.frame;
}

- (void)setFrame:(CGRect)frame{
    
    frame.size.height -= 8;
    frame.origin.y  += 8;
    frame.origin.x +=8;
    frame.size.width -=16;
    [super setFrame:frame];
}

@end
